package com.atguigu07.object.tostring.ex1;

public class Circle extends GeometricObject{
    private double radius;

    public Circle() {
        color="white";
        weight=1.0;
        radius=1.0;
    }

    public Circle(double radius) {
        this.radius = radius;
        color="white";
        weight=1.0;
    }

    public Circle(String color, double weight, double radius) {
        super(color, weight);
        this.radius = radius;
    }

    public double getRadius() {
        return radius;
    }

    public void setRadius(double radius) {
        this.radius = radius;
    }
    public double findArea(){
        return radius*radius*Math.PI;
    }
    public boolean equals(Object obj){
        if(obj==this){
            return true;
        }
        if(obj instanceof Circle){
            Circle c=(Circle) obj;
            if (c.radius==this.radius){
                return true;
            }
        }
        return false;
    }
    public  String toString(){
        return "圆的半径为"+this.radius;
    }
}
